//
// Created by liushuai on 2021/2/14.
//

#include "reverseVowels.h"
<<<<<<< HEAD:cxx/algorithm/src/reverseVowels.cc
string reverseVowels(string s){
    set<char> elem = {'a','e','i','o','u','A','E','I','O','U'};
    int start = 0;
    int end = s.length()-1;
    while(start<end){
        while(!elem.count(s[start])&&start<end)
            start++;
        while(!elem.count(s[end])&&start<end)
            end--;
        if(start<end)
            std::swap(s[start],s[end]);
        start++;
        end--;
    }

    return s;
=======
string reverseVowels(string s) {
  set<char> elem = {'a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U'};
  int start = 0;
  int end = s.length() - 1;
  while (start < end) {
    while (!elem.count(s[start]) && start < end) start++;
    while (!elem.count(s[end]) && start < end) end--;
    if (start < end) std::swap(s[start], s[end]);
    start++;
    end--;
  }

  return s;
>>>>>>> dev:cxx/algorithm/common/src/reverseVowels.cc
}
